-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: update the pandas.DataFrame.notna and pandas.Series.notna docstring #20160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: update the pandas.DataFrame.notna and pandas.Series.notna docstring #20160
Conversation
pandas/core/generic.py
Outdated
values. | ||
Everything else get mapped to False values. Characters such as empty | ||
strings `''` or :attr:`numpy.inf` are not considered NA values | ||
(unless you set :attr:`pandas.options.mode.use_inf_as_na` `= True`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this attr
work? I don't know if its in our API docs. I think it'd be ok to jsut have unless you set ``pandas.options.mode.use_inf_as_na = True``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have seen :attr: references throughout other docstrings (frame.py). I can change it, thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the attr
itself, but the fact there is nothing to link to I think?
I would rather make this ``pandas.options.mode.use_inf_as_na = True``
pandas/core/generic.py
Outdated
Return a boolean same-sized object indicating if the values are not NA. | ||
Non-missing values get mapped to True. Characters such as empty | ||
strings `''` or :attr:`numpy.inf` are not considered NA values | ||
(unless you set :attr:`pandas.options.mode.use_inf_as_na` `= True`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here about the pandas option.
pandas/core/generic.py
Outdated
|
||
Returns | ||
------- | ||
bool of type %(klass)s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this type annotation right? It looks like bool
is the return variable name (which is not needed).
https://python-sprints.github.io/pandas/guide/pandas_docstring.html#section-3-parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A complex type then? So it should be somehting like "dict of int", but it looks like it's inverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We get a DataFrame or a Series that contains boolean values.
It feels like writing DataFrame of bool
or Series of bool
may be harder to userstand for new users. Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guidelines specify that complex types should be written like list of bool
. Maybe you can just say that the return type is DataFrame
and in the explanation specify that its dtype is bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the type should be just %(klass)s
%(klass)s
Each element of the %(klass)s will be a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it's the closest to the guidelines.
Hello @Donk23! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on March 13, 2018 at 13:49 Hours UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice docstrings! Added a very minor comment
pandas/core/generic.py
Outdated
values. | ||
Everything else get mapped to False values. Characters such as empty | ||
strings `''` or :attr:`numpy.inf` are not considered NA values | ||
(unless you set :attr:`pandas.options.mode.use_inf_as_na` `= True`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the attr
itself, but the fact there is nothing to link to I think?
I would rather make this ``pandas.options.mode.use_inf_as_na = True``
pandas/core/generic.py
Outdated
Return a boolean same-sized object indicating if the values are NA. | ||
NA values, such as None or :attr:`numpy.NaN`, get mapped to True | ||
values. | ||
Everything else get mapped to False values. Characters such as empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get -> gets ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sry, not my language. Fixed the typos and changed the link as proposed in .notna docstring.
Codecov Report
@@ Coverage Diff @@
## master #20160 +/- ##
=========================================
Coverage ? 91.76%
=========================================
Files ? 150
Lines ? 49146
Branches ? 0
=========================================
Hits ? 45097
Misses ? 4049
Partials ? 0
Continue to review full report at Codecov.
|
@Donk23 Thanks a lot! If possible, welcome to check the online docs in a few hours to see if everything is looking OK: http://pandas-docs.github.io/pandas-docs-travis/generated/pandas.DataFrame.notna.html#pandas.DataFrame.notna |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Two Validations for pandas.DataFrame.notna and pandas.Series.notna (shared docs).